<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">

    <link rel="stylesheet" href="/gupiao/css/weui.css">
    <link rel="stylesheet" href="/gupiao/css/jquery-weui.css">
    <link rel="stylesheet" href="/gupiao/css/style.css">
    <link rel="stylesheet" href="http://at.alicdn.com/t/font_689900_raxzqh2p8ixm9529.css">

    <style>

    </style>
</head>
<body class="back1">


<div class="index-top-fix">
    <a href="{:url('gupiao.index/index')}" class="iconfont icon-left- left"></a>
    <p class="title">分享列表</p>
</div>

<div class="mt50"></div>

<div class="weui-search-bar" id="searchBar">
    <form class="weui-search-bar__form" id="search" action="">
        <div class="weui-search-bar__box">
            <i class="weui-icon-search"></i>
            <input type="hidden" name="type" id="type" value="{$type}">

            <input type="search" class="weui-search-bar__input" id="searchInput" placeholder="搜索" required="">
            <a href="javascript:" class="weui-icon-clear" id="searchClear"></a>
        </div>
        <label class="weui-search-bar__label" id="searchText">
            <i class="weui-icon-search"></i>
            <span>搜索</span>
        </label>
    </form>
    <a href="javascript:" class="weui-search-bar__cancel-btn" id="searchCancel">取消</a>
    <a href="javascript:" onclick="login()" class="weui-search-bar__cancel-btn" > 确定</a>
</div>

<div class="gegu-list-box share-list-box">
    <ul>
        <li>
            <p class="al" style="text-align: center">文章标题</p>
            <p>发布时间</p>
        </li>
    </ul>
    <ul id="list">
        <li>
            <p class="al" style="text-align: center">文章标题</p>
            <p>发布时间</p>
        </li>
    </ul>
</div>

<div class="weui-loadmore"  id="loadmore">
    <span class="weui-loadmore__tips">正在加载</span>
</div>

<!--客服调用-->
<div class="kefu" style="display:none;">
    <a href="tel:{$web_config.kf_tel}">
        <div class="iconbox">
            <i class="iconfont icon-kefu1"></i>
        </div>
    </a>
</div>

<script src="/gupiao/js/jquery.min.js"></script>
<script src="/gupiao/js/jquery-weui.min.js"></script>

<script>
// 获取第一页数据
article_list(0);

// 检索
function login()
{
    article_list(0);
}

// 一部获取列表
function article_list(_page)
{
    _page++;

    var type = document.getElementById('type').value;

    // 检索条件
    var keyword = document.getElementById('searchInput').value;

    // 评论列表是要加下拉刷新的
    $.ajax({
        type: "GET",
        url: "{:url('xcx/lists')}",
        data: {type:type,page:_page,keyword:keyword},
        dataType: 'json',
        success: function (res) {
            var  html ='';
            if (res.code == 200) {

                var banner  = res.data;
                var html    = '';
                var pid;
                for(var i=0;i<banner.length;i++){

                    var data = res.data[i];

                    if(data.is_new == "1"){
                        html += "<li><p class='al'><i class='iconfont icon-xin'></i>"+data.title+"</p><p>"+data.create_time+"</p>" +
                            "<input type='hidden' name='id' id='"+data.id+"'></li>";
                    } else if (data.is_new == "0"){
                        html += "<li><p class='al'><i class='iconfont icon-xin'></i>"+data.title+"</p><p>"+data.create_time+"</p>" +
                            "<input type='hidden' name='id' id='"+data.id+"'></li>";
                    }
                }

                // 数据展示方式
                if(_page == 1){
                    $("#list").html(html);    
                }else{
                    $("#list").append(html);
                }
                // locading  这个时候关闭
                if(res.data.length < 15){
                    $("#loadmore").hide();
                }
                
                $("#loadmore").click(function(){
                    article_list(_page);  
                });

                $('#list li').on('click', function(){
                    // 获取到的是股票名称的 id
                    pid =$(this).find("input").attr('id'); //获取的id
                    // 跳到详情页把id的值带过去
                    location.href ="{:url('gupiao.lists/sharelnfo')}?id="+pid;

                });
            }
        }
    })
}
</script>

<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
    //
    wx.config({
        debug: false,
        appId: '{$jsconfig.appId}',
        timestamp: '{$jsconfig.timestamp}',
        nonceStr: '{$jsconfig.noncestr}',
        signature: '{$jsconfig.signature}',
        jsApiList: [
            'checkJsApi',
            'onMenuShareTimeline',
            'onMenuShareAppMessage',
            'onMenuShareQQ',
            'onMenuShareWeibo',
            'hideMenuItems',
            'showMenuItems',
            'hideAllNonBaseMenuItem',
            'showAllNonBaseMenuItem',
            'translateVoice',
            'startRecord',
            'stopRecord',
            'onRecordEnd',
            'playVoice',
            'pauseVoice',
            'stopVoice',
            'uploadVoice',
            'downloadVoice',
            'chooseImage',
            'previewImage',
            'uploadImage',
            'downloadImage',
            'getNetworkType',
            'openLocation',
            'getLocation',
            'hideOptionMenu',
            'showOptionMenu',
            'closeWindow',
            'scanQRCode',
            'chooseWXPay',
            'openProductSpecificView',
            'addCard',
            'chooseCard',
            'openCard'
        ]
    });
    wx.isInit = false;

    wx.ready(function () {

        // 禁用分享菜单
        wx.hideOptionMenu();
        
    });

    wx.error(function (res) {
        alert(res.errMsg);
    });


</script>

</body>
</html>

